layui.use('laydate', function() {
    var laydate = layui.laydate;
    var $ = layui.jquery;
    <!--运营首页导航-->
    $('#button_id1').click(function(){
        location.reload();
    });
    $('#button_id2').click(function(){
        //返回上一页并刷新：
        window.location.href = document.referrer;
    });
    //常规用法
    laydate.render({
        elem: '#test1',
        type:'datetime',
        trigger:'click'
        ,done: function(value, date){
            var dass=['0.00~3.00', '3.00~6.00', '6.00~9.00', '9.00~12.00', '12.00~15.00', '15.00~18.00', '18.00~21.00', '21.00~0.00'];
           if(value!=null){
               $.ajax({
                   url: '/SyOperationController/SelectSyOrderStatistics',
                   type: 'post',
                   data: {value:value,"timeDate":dass},
                   success: function (data) {
                       selOperationlog("查询详情")
                       // 基于准备好的dom，初始化echarts实例
                       var myChart = echarts.init(document.getElementById('main'));
                       // 指定图表的配置项和数据
                       option = {
                           title: {
                               text: '昨日订单',
                           },
                           tooltip: {
                               trigger: 'axis'
                           },
                           toolbox: {
                               show: true,
                               feature: {
                                   dataView: {show: true, readOnly: false},
                                   magicType: {show: true, type: ['line', 'bar']},
                                   restore: {show: true},
                                   saveAsImage: {show: true}
                               }
                           },
                           calculable: true,
                           xAxis: [
                               {
                                   type: 'category',
                                   data:dass
                               }
                           ],
                           yAxis: [
                               {
                                   type: 'value'
                               }
                           ],
                           series: [
                               {
                                   name: '昨日订单',
                                   type: 'bar',
                                   data: data.data,
                                   markPoint: {
                                       data: [
                                           {type: 'max', name: '最大值'},
                                           {type: 'min', name: '最小值'}
                                       ]
                                   },
                                   markLine: {
                                       data: [
                                           {type: 'average', name: '平均值'}
                                       ]
                                   }
                               }
                           ]
                       };
// 使用刚指定的配置项和数据显示图表。

                       myChart.setOption(option);
                   }
               })
           }else if(value=null){
               //待处理事务
               $.ajax({
                   url:'/SyOperationController/SelectSyOrderStatistics',
                   type:'post',
                   data:{"timeDate":dass},
                   success:function(data){
                       // 基于准备好的dom，初始化echarts实例
                       var myChart = echarts.init(document.getElementById('main'));
                       // 指定图表的配置项和数据
                       option = {
                           title: {
                               text: '昨日订单',
                           },
                           tooltip: {
                               trigger: 'axis'
                           },
                           toolbox: {
                               show: true,
                               feature: {
                                   dataView: {show: true, readOnly: false},
                                   magicType: {show: true, type: ['line', 'bar']},
                                   restore: {show: true},
                                   saveAsImage: {show: true}
                               }
                           },
                           calculable: true,
                           xAxis: [
                               {
                                   type: 'category',
                                   data:dass
                               }
                           ],
                           yAxis: [
                               {
                                   type: 'value'
                               }
                           ],
                           series: [
                               {
                                   name: '昨日订单',
                                   type: 'bar',
                                   data: data.data,
                                   markPoint: {
                                       data: [
                                           {type: 'max', name: '最大值'},
                                           {type: 'min', name: '最小值'}
                                       ]
                                   },
                                   markLine: {
                                       data: [
                                           {type: 'average', name: '平均值'}
                                       ]
                                   }
                               }
                           ]
                       };
// 使用刚指定的配置项和数据显示图表。

                       myChart.setOption(option);

                   }
               });
           }
        }
    });
    //总览
    var QuanBuDanZongShu;
    $.ajax({
        url:'/SyOperationController/SelectSyPendingCourses',
        type:'post',
        data:'',
        success:function(data) {
            $("#p_id2").html(data.data);
            QuanBuDanZongShu=data.data;
        }
    });
    //昨日订单总数
    $.ajax({
        url:'/SyOperationController/SelectSyOrderDingDan',
        type:'post',
        data:'',
        success:function(data) {
            $("#p_id1").html(data.data);
            $("#p_id10").html(data.data);
            var c=QuanBuDanZongShu-data.data;
            $("#p_id11").html(c/100+'%');
        }
    });

    //昨日总金额
    $.ajax({
        url:'/SyOperationController/OrderDingDanMonery',
        type:'post',
        data:'',
        success:function(data) {
            selOperationlog("昨日总金额")
            $("#p_id3").html(data.data);
        }
    });
    $.ajax({
        url:'/SyOperationController/SelectSySales',
        type:'post',
        data:'',
        success:function(data){
            selOperationlog("昨日订单详情")
            $("#p_id3").html(data.data);
            $("#p_id4").html(data.data);
        }
    });
    //待处理事务
    $.ajax({
        url:'/SyOperationController/SelectSyPending',
        type:'post',
        data:'',
        success:function(data){
            selOperationlog("待处理事务")
            $("#i_id5").html(data.data);
        }
    });
    $.ajax({
        url:'/SyOperationController/SelectSyCommodity',
        type:'post',
        data:'',
        success:function(data){
            selOperationlog("待处理事务")
            $("#i_id6").html(data.data);
        }
    });
})
